<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class SiteRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $site = $this->route('site');
        if($site) $id = $site->id;
        else $id = 0;
        return [
            'title' => 'required|between:1,100|unique:sites,title,' . $id,
            'template_color' => 'sometimes|nullable',
            'qrcode_link' => 'sometimes|nullable|url',
            // 'video_link' => 'sometimes|'
            'top_image_src' => 'sometimes|nullable|url',
            'video_title' => 'sometimes|nullable|between:1,25',
            'top_image_link' => 'sometimes|nullable|url',
        ];
    }
}
